<template>
  <div>
    <el-form :inline="true" :model="search" class="demo-form-inline">
        
      <el-row class="table-head-box">
        <el-col :span="24" class="flex flex-end input-box">
          <el-form-item label="订单编号：">
            <el-input v-model="search.eqParam.order_numb" clearable placeholder="订单编号"></el-input>
        </el-form-item>
        <el-form-item label="顾客手机号：">
            <el-input v-model="search.eqParam.mobile" clearable placeholder="手机号"></el-input>
        </el-form-item>
        <el-form-item label="门店名称：">
            <el-input v-model="search.lkParam.storeName" clearable placeholder="门店名称"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" icon="el-icon-search" @click="searchHandler">查询</el-button>
        </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <el-table :data="userList" border style="width: 100%" tooltip-effect="dark" size="mini">
      <el-table-column type="selection" width="55">
      </el-table-column>
       <el-table-column  prop="orderNumb" label="订单编号" width="150">
      </el-table-column>
      <el-table-column  prop="mobile" label="用户手机号" width="150">
      </el-table-column>
       <el-table-column  prop="storeName" label="门店名称" width="150">
      </el-table-column>
      <el-table-column  prop="serviceName" label="服务名称" width="150">
      </el-table-column>
      <el-table-column prop="petName" label="宠物" width="120">
      </el-table-column>
      <el-table-column prop="appointmentTime" label="预约时间" width="120">
      </el-table-column>
       <el-table-column prop="actualPrice" label="实际价格" width="120">
      </el-table-column>
       <el-table-column prop="pickupGoodPrice" label="上门取货价格" width="120">
      </el-table-column>
      <el-table-column prop="totlePrice" label="合计价格" width="120">
      </el-table-column>
      <el-table-column prop="arrivalTime" label="到店时间" width="120">
      </el-table-column>
      <el-table-column prop="confirmationCode" label="确认码" width="120">
      </el-table-column>
      <el-table-column prop="arrivalTime" label="到店时间" width="120">
      </el-table-column>
       <el-table-column prop="payWay" label="支付方式" width="120">
         <template slot-scope="scope">
            <div v-if="scope.row.payWay==1">支付宝</div>
            <div v-if="scope.row.payWay==2">微信</div>
            <div v-if="scope.row.payWay==3">其他</div>

         </template>
      </el-table-column>
      <el-table-column prop="payStaus" label="支付状态" width="120">
         <template slot-scope="scope">
            <div v-if="scope.row.payStaus==1">进行中</div>
            <div v-if="scope.row.payStaus==2">成功</div>
            <div v-if="scope.row.payStaus==3">失败</div>

         </template>
      </el-table-column>

      <el-table-column prop="status" label="状态" width="300">
        <template slot-scope="scope">
          <div v-if="scope.row.status == 0">已取消</div>
          <div v-if="scope.row.status == 1">待服务</div>
          <div v-if="scope.row.status == 2">服务中</div>
          <div v-if="scope.row.status == 3">服务完成</div>
        </template>
      </el-table-column>
    </el-table>
    <el-row>
      <el-col :span="24" style="text-align:right;">
          <el-pagination background layout="total,prev, pager, next" :page-count="search.size" :current-page="search.current" :total="search.total" @current-change="sizeChangeHandler"> </el-pagination>
      </el-col>
    </el-row>
  </div>

</template>
<script>
import {orderManageListUrl} from '@/utils/common'
export default {
  components: {
  },
  data() {
    return {
      userList: [],
      merchart: null,
      showMerchantDialog: false,
      authorizationDialog: false,
      userId: null,
      search: {
        current:1,
        size:10,
        total: 0,
        lkParam: {userName:""},
        eqParam:{},
      }
    };
  },
  mounted() {
    this.loadOrders();
  },
  methods: {
    addStoreHandler: function () {
      this.merchart = { type:1,status:1};
      this.showMerchantDialog = true;
    },
    updateUserHandler: function (index, row) {
      this.merchart = row;
      this.showMerchantDialog = true;
    },
    closeHandler: function () {
      this.showMerchantDialog = false;
      this.loadOrders();
    },
    /**
     * 删除用户
     */
    deleteUserHandler: function (index, row) {
      this.$confirm("此操作将永久删除该用户, 是否继续?", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", type: "warning" })
        .then(() => {
          this.axios
            .post("/fc/su/del/" + row.userId)
            .then(response => {
                console.log(response)
              this.$message({ type: "success", message: "删除成功!"  });
              this.loadOrders();
            })
            .catch(response => {
                console.log(response)
              this.$message({ type: "warn", message: "删除失败!"  });
            });
        })
        .catch(() => {
          this.$message({ type: "info", message: "已取消删除" });
        });
    },
    loadOrders() {
      this.axios
        .post(orderManageListUrl, this.search)
        .then(response => {
          var data = response.data.data;
          this.userList = data.records;
          this.search.total = data.total
        })
        .catch(response => {
          console.log("response -   " + response);
        });
    },
    sizeChangeHandler: function (value) {
      this.search.current = value;
      this.loadOrders();
    },
    searchHandler: function () {
      this.search.current=1
      this.loadOrders();
    }
  }
};
</script>
<style scoped>
.grid-content {
  text-align: left;
  height: 45px;
}
</style>
